import express, { Router } from 'express';
import { AuthController } from '../controllers/AuthController';
import { 
  validate, 
  registerValidation, 
  loginValidation, 
  refreshTokenValidation,
  forgotPasswordValidation,
  resetPasswordValidation 
} from '../middleware/validation';

const router: Router = express.Router();
const authController = new AuthController();

// 用户注册
router.post('/register', validate(registerValidation), authController.register);

// 用户登录
router.post('/login', validate(loginValidation), authController.login);

// 刷新令牌
router.post('/refresh', validate(refreshTokenValidation), authController.refreshToken);

// 登出
router.post('/logout', authController.logout);

// 忘记密码
router.post('/forgot-password', validate(forgotPasswordValidation), authController.forgotPassword);

// 重置密码
router.post('/reset-password', validate(resetPasswordValidation), authController.resetPassword);

export default router;